/*
 * Copyright (C) 2015 MediaTek Inc.
 * Copyright (C) 2021 XiaoMi, Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */

#ifndef _MTK_DRM_GRAPHICS_BASE_H_
#define _MTK_DRM_GRAPHICS_BASE_H_

enum mtk_drm_dataspace {
	MTK_DRM_DATASPACE_UNKNOWN = 0,
	MTK_DRM_DATASPACE_ARBITRARY = 1,
	MTK_DRM_DATASPACE_STANDARD_SHIFT = 16,
	/* (63 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_MASK = 4128768,
	/* (0 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_UNSPECIFIED = 0,
	/* (1 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_BT709 = 65536,
	/* (2 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_BT601_625 = 131072,
	/* (3 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_BT601_625_UNADJUSTED = 196608,
	/* (4 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_BT601_525 = 262144,
	/* (5 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_BT601_525_UNADJUSTED = 327680,
	/* (6 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_BT2020 = 393216,
	/* (7 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_BT2020_CONSTANT_LUMINANCE = 458752,
	/* (8 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_BT470M = 524288,
	/* (9 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_FILM = 589824,
	/* (10 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_DCI_P3 = 655360,
	/* (11 << STANDARD_SHIFT) */
	MTK_DRM_DATASPACE_STANDARD_ADOBE_RGB = 720896,
	MTK_DRM_DATASPACE_TRANSFER_SHIFT = 22,
	/* (31 << TRANSFER_SHIFT) */
	MTK_DRM_DATASPACE_TRANSFER_MASK = 130023424,
	/* (0 << TRANSFER_SHIFT) */
	MTK_DRM_DATASPACE_TRANSFER_UNSPECIFIED = 0,
	/* (1 << TRANSFER_SHIFT) */
	MTK_DRM_DATASPACE_TRANSFER_LINEAR = 4194304,
	/* (2 << TRANSFER_SHIFT) */
	MTK_DRM_DATASPACE_TRANSFER_SRGB = 8388608,
	/* (3 << TRANSFER_SHIFT) */
	MTK_DRM_DATASPACE_TRANSFER_SMPTE_170M = 12582912,
	/* (4 << TRANSFER_SHIFT) */
	MTK_DRM_DATASPACE_TRANSFER_GAMMA2_2 = 16777216,
	/* (5 << TRANSFER_SHIFT) */
	MTK_DRM_DATASPACE_TRANSFER_GAMMA2_6 = 20971520,
	/* (6 << TRANSFER_SHIFT) */
	MTK_DRM_DATASPACE_TRANSFER_GAMMA2_8 = 25165824,
	/* (7 << TRANSFER_SHIFT) */
	MTK_DRM_DATASPACE_TRANSFER_ST2084 = 29360128,
	/* (8 << TRANSFER_SHIFT) */
	MTK_DRM_DATASPACE_TRANSFER_HLG = 33554432,
	MTK_DRM_DATASPACE_RANGE_SHIFT = 27,
	/* (7 << RANGE_SHIFT) */
	MTK_DRM_DATASPACE_RANGE_MASK = 939524096,
	/* (0 << RANGE_SHIFT) */
	MTK_DRM_DATASPACE_RANGE_UNSPECIFIED = 0,
	/* (1 << RANGE_SHIFT) */
	MTK_DRM_DATASPACE_RANGE_FULL = 134217728,
	/* (2 << RANGE_SHIFT) */
	MTK_DRM_DATASPACE_RANGE_LIMITED = 268435456,
	/* (3 << RANGE_SHIFT) */
	MTK_DRM_DATASPACE_RANGE_EXTENDED = 402653184,
	MTK_DRM_DATASPACE_SRGB_LINEAR = 512,
	/* ((STANDARD_BT709 | TRANSFER_LINEAR) | RANGE_FULL) */
	MTK_DRM_DATASPACE_V0_SRGB_LINEAR = 138477568,
	/* ((STANDARD_BT709 | TRANSFER_LINEAR) | RANGE_EXTENDED) */
	MTK_DRM_DATASPACE_V0_SCRGB_LINEAR = 406913024,
	MTK_DRM_DATASPACE_SRGB = 513,
	/* ((STANDARD_BT709 | TRANSFER_SRGB) | RANGE_FULL) */
	MTK_DRM_DATASPACE_V0_SRGB = 142671872,
	/* ((STANDARD_BT709 | TRANSFER_SRGB) | RANGE_EXTENDED) */
	MTK_DRM_DATASPACE_V0_SCRGB = 411107328,
	MTK_DRM_DATASPACE_JFIF = 257,
	/* ((STANDARD_BT601_625 | TRANSFER_SMPTE_170M) | RANGE_FULL) */
	MTK_DRM_DATASPACE_V0_JFIF = 146931712,
	MTK_DRM_DATASPACE_BT601_625 = 258,
	/* ((STANDARD_BT601_625 | TRANSFER_SMPTE_170M) | RANGE_LIMITED) */
	MTK_DRM_DATASPACE_V0_BT601_625 = 281149440,
	MTK_DRM_DATASPACE_BT601_525 = 259,
	/* ((STANDARD_BT601_525 | TRANSFER_SMPTE_170M) | RANGE_LIMITED) */
	MTK_DRM_DATASPACE_V0_BT601_525 = 281280512,
	MTK_DRM_DATASPACE_BT709 = 260,
	/* ((STANDARD_BT709 | TRANSFER_SMPTE_170M) | RANGE_LIMITED) */
	MTK_DRM_DATASPACE_V0_BT709 = 281083904,
	/* ((STANDARD_DCI_P3 | TRANSFER_LINEAR) | RANGE_FULL) */
	MTK_DRM_DATASPACE_DCI_P3_LINEAR = 139067392,
	/* ((STANDARD_DCI_P3 | TRANSFER_GAMMA2_6) | RANGE_FULL) */
	MTK_DRM_DATASPACE_DCI_P3 = 155844608,
	/* ((STANDARD_DCI_P3 | TRANSFER_LINEAR) | RANGE_FULL) */
	MTK_DRM_DATASPACE_DISPLAY_P3_LINEAR = 139067392,
	/* ((STANDARD_DCI_P3 | TRANSFER_SRGB) | RANGE_FULL) */
	MTK_DRM_DATASPACE_DISPLAY_P3 = 143261696,
	/* ((STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2) | RANGE_FULL) */
	MTK_DRM_DATASPACE_ADOBE_RGB = 151715840,
	/* ((STANDARD_BT2020 | TRANSFER_LINEAR) | RANGE_FULL) */
	MTK_DRM_DATASPACE_BT2020_LINEAR = 138805248,
	/* ((STANDARD_BT2020 | TRANSFER_SMPTE_170M) | RANGE_FULL) */
	MTK_DRM_DATASPACE_BT2020 = 147193856,
	/* ((STANDARD_BT2020 | TRANSFER_ST2084) | RANGE_FULL) */
	MTK_DRM_DATASPACE_BT2020_PQ = 163971072,
	MTK_DRM_DATASPACE_DEPTH = 4096,
	MTK_DRM_DATASPACE_SENSOR = 4097,
};

enum mtk_drm_color_mode {
	MTK_DRM_COLOR_MODE_NATIVE = 0,
	MTK_DRM_COLOR_MODE_STANDARD_BT601_625 = 1,
	MTK_DRM_COLOR_MODE_STANDARD_BT601_625_UNADJUSTED = 2,
	MTK_DRM_COLOR_MODE_STANDARD_BT601_525 = 3,
	MTK_DRM_COLOR_MODE_STANDARD_BT601_525_UNADJUSTED = 4,
	MTK_DRM_COLOR_MODE_STANDARD_BT709 = 5,
	MTK_DRM_COLOR_MODE_DCI_P3 = 6,
	MTK_DRM_COLOR_MODE_SRGB = 7,
	MTK_DRM_COLOR_MODE_ADOBE_RGB = 8,
	MTK_DRM_COLOR_MODE_DISPLAY_P3 = 9,
};

#endif
